//
//  MainTabBarController.m
//  CangLongWnnianli
//
//  Created by 暗流澎涌 on 2025/7/2.
//

#import "MainTabBarController.h"
#import "HomeViewController.h"
#import "CalendarViewController.h"
#import "ProfileViewController.h"
#import "MuyuViewController.h"
#import "BirthdayViewController.h"
@interface MainTabBarController ()

@end

@implementation MainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupTabBar];
}

- (void)setupTabBar {
    // 创建视图控制器
    HomeViewController *homeVC = [[HomeViewController alloc] init];
    CalendarViewController *calendarVC = [[CalendarViewController alloc] init];
    // ToolsViewController *toolsVC = [[ToolsViewController alloc] init];
    MuyuViewController * muyuVC = [[MuyuViewController alloc] init];
    BirthdayViewController *birthdayVC = [[BirthdayViewController alloc] init];
    ProfileViewController *profileVC = [[ProfileViewController alloc] init];
    
    // 设置标题和图标
    homeVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" 
                                                       image:[UIImage systemImageNamed:@"house"] 
                                               selectedImage:[UIImage systemImageNamed:@"house.fill"]];
    
    calendarVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"吉日" 
                                                         image:[UIImage systemImageNamed:@"sparkles"] 
                                                 selectedImage:[UIImage systemImageNamed:@"sparkles"]];
    
    muyuVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"木鱼"
                                                        image:[UIImage imageNamed:@"muyu_gray"]
                                                selectedImage:[UIImage imageNamed:@"muyu_hong"]];
    
    birthdayVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"生日" 
                                                          image:[UIImage systemImageNamed:@"plus.circle"] 
                                                  selectedImage:[UIImage systemImageNamed:@"plus.circle.fill"]];
    
    profileVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" 
                                                         image:[UIImage systemImageNamed:@"person"] 
                                                 selectedImage:[UIImage systemImageNamed:@"person.fill"]];
    
    // 设置视图控制器数组
    self.viewControllers = @[
        [[UINavigationController alloc] initWithRootViewController:homeVC],
//        [[UINavigationController alloc] initWithRootViewController:calendarVC],
        [[UINavigationController alloc] initWithRootViewController:muyuVC],
        [[UINavigationController alloc] initWithRootViewController:birthdayVC],
        [[UINavigationController alloc] initWithRootViewController:profileVC]
    ];
    
    // 设置标签栏样式
    self.tabBar.tintColor = [UIColor colorWithRed:0.773 green:0.188 blue:0.188 alpha:1.0];
    self.tabBar.unselectedItemTintColor = [UIColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:1.0];
    self.tabBar.backgroundColor = [UIColor whiteColor];
    
    // 隐藏导航栏
    for (UINavigationController *navController in self.viewControllers) {
        navController.navigationBarHidden = YES;
    }
}

@end
